package com.huawei.service.impl;

import com.huawei.dao.*;
import com.huawei.entity.Shopping_cart;
import com.huawei.entity.Sppinglun;
import com.huawei.service.Shopping_cartService;
import com.huawei.service.SppinglunService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @ClassName U
 * @Description TODO
 * @Author 闫修奇
 * @Date 2021/11/27 17:14
 */

 @Service
public class SppinglunServiceImpl implements SppinglunService {
    @Resource
    SppinglunMpper sppinglunMpper;
    @Resource
    UserMapper userMapper;
@Resource
SpuMapper spuMapper;

    @Resource
    ManagerMapper managerMapper;
    @Override
    public List<Sppinglun> select(Map<String,Object>pars) {
     List<Sppinglun> list=sppinglunMpper.select(pars);

        for(Sppinglun n:list){
            n.setUsers(userMapper.getId(n.getUser_id()));
           n.setShangpinspus(spuMapper.getId(n.getId()));
            n.setManagers(managerMapper.getId(n.getIs_staff()));
        }
        return list;

    }

    @Override
    public int count(Map<String,Object>pars) {
        return sppinglunMpper.count(pars);
    }

    @Override
    public int add(Sppinglun sppinglun) {

            return sppinglunMpper.add(sppinglun);

    }

   @Override
    public int update(Sppinglun sppinglun) {

            return sppinglunMpper.update(sppinglun);

    }

    @Override
    public int delete(int id) {
        return sppinglunMpper.delete(id);
    }

    @Override
    public int updates(int id, String sp_status) {
        return sppinglunMpper.updates(id,sp_status);
    }

    @Override
    public int huifu(int id, String huifu) {
        return sppinglunMpper.huifu(id,huifu);
    }


}
